<template>
    <Modal
        v-model="modal.show"
        :title="modal.title"
        :loading="modal.loading"
        @on-ok="handleOk"
        @on-cancel="handleCancel"
    >
        <DataForm ref="formValidate" :data="formData" :label-width="80"></DataForm>
    </Modal>
</template>
<script>
    import DataForm from './index.vue';
    export default {
        name:'FormModal',
        props:{
            formData:{
                type:Object,
                default:() => {}
            },
            labelWidth:{
                type:[Number,String],
                default:80
            }
        },
        data() {
            return {
                modal: {
                    show: false,
                    data: '',
                    loading: true
                }
            }
        },
        mounted(){
            
        },
        methods:{
            handOk(){
                this.$refs.formValidate.validate((valid) => {
                    if(valid){
                        this.$emit('on-ok',valid)
                    }
                })
            },
            openModal(){
                
            },
            handleCancel(){
                this.modal.show = false
            }
        },
    }
</script>
